是否可以指定sbt使用的scala编译器?

时间:2016-07-23 09:59:31

标签: scala sbt

我修改了scala编译器的源代码并构建了它。现在我想测试这个编译器。但是,许多现有的scala项目使用sbt作为构建工具。所以我想知道是否有可能用我自己构建的scala编译器替换sbt使用的官方scala编译器。

2 个答案:

答案 0 :(得分:0)

根据docs,它很简单:

managedScalaInstance := false

libraryDependencies += "yourPackage" % "yourScalaCompiler" % version

不要忘记先编译publish-local

答案 1 :(得分:0)

请参阅http://www.scala-sbt.org/1.0/docs/Configuring-Scala.html#Using+Scala+from+a+local+directory

  

从源代码构建Scala的结果是Scala主目录scalaHome := Some(file("/home/user/scala-2.10/")) ,其中包含一个包含Scala库,编译器和其他jar的子目录publish。通过下载和提取Scala分发获得相同的目录布局。通过设置scalaHome,可以将这样的Scala主目录用作jar的源。例如,

 Intent resultIntent = new Intent(context, BlankBranchShareActivity.class);
    resultIntent.putExtra("branch", "https://bnc.lt/EcMh/POIo83vYev");

    PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    String title = "DeepLink";
    String message = "messageDeepLink";
    String summaryText = "summaryText";
    NotificationUtility.createNotification(context, title,
            message, summaryText,
            mNotificationId++, resultPendingIntent,
            CancelNotificationResponse.getPendingIntent(context, messageType));

如果你想public class BlankBranchShareActivity extends AppCompatActivity { private static final String TAG = BlankBranchShareActivity.class.getName(); private Branch branch; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); branch = Branch.getInstance(); } @Override public void onStart() { super.onStart(); branch.initSession(branchReferralInitListener, this.getIntent().getData(), this); } Branch.BranchReferralInitListener branchReferralInitListener = new Branch.BranchReferralInitListener() { @Override public void onInitFinished(JSONObject referringParams, BranchError error) { String label = ""; if (referringParams != null) label = "ReferringParams" + referringParams.toString(); if (error == null) { JSONObject json = referringParams; onCodeResume(json); return; } if (AppConstants.DEBUG) { Log.i(TAG, "onStart()" + label + ",Error:" + error); } openMainActivity(); } }; protected void onCodeResume(JSONObject json) { super.onResume(); try { Log.i(TAG, "onResume: " + "Called" + json.toString()); /*If nothing is their to-launch immediately Launch Main activity */ if (json == null || json.toString().equals("{}") || (!json.has(JsonKeys.BRANCH_IO_JOB_SHARE_KEY) && !json.has(JsonKeys.BRANCH_IO_SHARE_TYPE_SHARE_KEY))) { return; } //Do Operation } catch (JSONException e) { Crashlytics.logException(e); Log.e(TAG, "onResume: " + e.toString()); } } private void openMainActivity() { Intent in = new Intent(this, MainActivityList.class); startActivity(in); } @Override public void onNewIntent(Intent intent) { this.setIntent(intent); } @Override protected void onStop() { super.onStop(); if (branch != null) { branch.closeSession(); } } 编译器,请使用@ ipoteka的答案。