Skip to content

Import the jsDependencies plugin from the Scala.js core repository. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 68 commits into from
Jun 3, 2017

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jun 1, 2017

This is the initial import of sbt plugin for jsDependencies from the Scala.js core repository. The history of this commit reflects the entire history of relevant files from the core repo, filter-branch'ed to appear as if they had always been in this repo. This commit adds the specific setup of the build and tests.

The history was created in a similar way as for scala-js/scala-js-env-phantomjs#1. It based on commit scala-js/scala-js@cc6610b from the core repository.

Step 1: keep only relevant files and their history

git filter-branch \
    --prune-empty \
    --index-filter '
  git ls-tree -z -r --name-only --full-tree $GIT_COMMIT \
    | grep -z -v "^jsdependencies-sbt-plugin/src/main/scala/org/scalajs/jsdependencies/sbtplugin/JSDependenciesPlugin.scala$" \
    | grep -z -v "^sbt-plugin/src/main/scala/scala/scalajs/sbtplugin/JSModuleIDs.scala$" \
    | grep -z -v "^sbt-plugin/src/main/scala/scala/scalajs/sbtplugin/AbstractJSDeps.scala$" \
    | grep -z -v "^sbt-plugin/src/main/scala/org/scalajs/sbtplugin/AbstractJSDeps.scala$" \
    | grep -z -v "^jsdependencies-sbt-plugin/src/main/scala/org/scalajs/jsdependencies/sbtplugin/AbstractJSDeps.scala$" \
    | grep -z -v "^tools/src/main/scala/scala/scalajs/tools/jsdep/" \
    | grep -z -v "^tools/shared/src/main/scala/scala/scalajs/tools/jsdep/" \
    | grep -z -v "^tools/shared/src/main/scala/org/scalajs/core/tools/jsdep/" \
    | grep -z -v "^jsdependencies-core/src/main/scala/org/scalajs/jsdependencies/core/" \
    | grep -z -v "^tools/shared/src/test/scala/org/scalajs/core/tools/jsdep/" \
    | grep -z -v "^jsdependencies-core/src/test/scala/org/scalajs/jsdependencies/core/" \
    | grep -z -v "^sbt-plugin-test/build.sbt$" \
    | grep -z -v "^sbt-plugin-test/project/build.sbt$" \
    | grep -z -v "^sbt-plugin-test/jsDependenciesTest/" \
    | xargs -0 -r git rm -r --cached
  ' HEAD

Result: https://github.com/sjrd/jsdependencies/tree/import-from-core-step1

Step 2: remove empty merge commit

git filter-branch --prune-empty --parent-filter 'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"'

Result: https://github.com/sjrd/jsdependencies/tree/import-from-core-step2

Step 3: attach to the Initial commit of this repo

The initial commit is 9c45fa5

git filter-branch --parent-filter 'sed "s/ca1d58a31e27756c0d07fd65fbfdb1a3e0c6642e/9c45fa5a48df1df84a651ce396a37e043f2525f2/"'

Result: https://github.com/sjrd/jsdependencies/tree/import-from-core-step3

Step 4: reset files from the Initial commit

git filter-branch --index-filter 'git reset 9c45fa5a48df1df84a651ce396a37e043f2525f2 -- .gitignore LICENSE README.md'

Result: https://github.com/sjrd/jsdependencies/tree/import-from-core-step4

Step 5: rewrite references to issues to point to the core repo

git filter-branch --msg-filter 'sed -r -e "s/(#[0-9]+)/scala-js\/scala-js\1/g"'

Result: https://github.com/sjrd/jsdependencies/tree/import-from-core-step5

gzm0 and others added 30 commits May 2, 2014 11:19
A JS_DEPENDENCIES manifest file is added to each configuration
classpath and exported in JARs. This way, libraries may declare what
exact JS files should be included from a WebJar they depend on. (Or
what JS files they provide themselves should be included).

Example usages can be found in the build definitions for the
jasmine-test-framework and the testing example.

- This completely removes `importScripts` and fixes scala-js/scala-js#457
- The project's classpath is fully available even in the post package
  stages. This is necessary to allow for discovery of dependency
  manifests and JS libraries the project depends on.
The new API allows for classpaths to be partially linked
(n.b. packageExternalDeps, this commit fixes scala-js/scala-js#609).
Note that we cannot use the AutoPlugin in our build itself,
because we need the *abstract* set of settings. However, the
AutoPlugin is tested in sbt-plugin-test.
This hopefully simplifies build definitions that need to tweak some
command line options or just force a given environment.

At the same time, this also fixes scala-js/scala-js#1302 (use proper class loader for
PhantomJSEnv in our CI).
Rename former RuntimeDOM to RuntimeDOMDep to avoid import conflicts.
…cyManifest.

This is necessary for the sbt plugin to avoid recreating the
JS_DEPENDENCIES file over and over again, constantly invalidating
the output of fastOptJS and fullOptJS.
Partial paths written in jsDependencies (including just
file names) are shorthands for the full relative paths
wrt. the classpath entries.

Different partial paths resolving to the same full relative
paths are considered equivalent for dependency resolution
and ordering.

If a partial path does not resolve to a unique full relative
path on the classpath, a JSLibResolveException is thrown.
Fix scala-js/scala-js#1569: Allow crossProject's JVM and JS parts to be used in a ProjectRef
sjrd and others added 26 commits January 17, 2016 19:18
We use sbt's tag mechanism to prevent concurrent execution.

The test failed 60 consecutive times before the change and succeeded 60
consecutive times after it on a 2 core machine.
This sbt setting is true if and only if the current project is
a Scala.js project. It is not meant to be written to by users
(only to be read).
… attributes.

The source maps of `fastOptJS` can now be accessed with
`fastOptJS.value.get(scalaJSSourceMap).get`, and similarly for
`fullOptJS`.
This is part of scala-js/scala-js#2839.

* `PhantomJSEnv` and `RetryingComJSEnv` are sent to their own
  `phantomJSEnv` sbt project.
* The settings and tasks used to construct the `ClassLoader` that
  loads jetty8 are extracted into a separate `AutoPlugin`, named
  `PhantomJSEnvPlugin`, in the sbt project `phantomJSEnvPlugin`.
* The tests in `sbt-plugin-test` do not mix PhantomJS-related tests
  with other tests anymore (in particular `jsDependencies`).
This turns withDOM into a test for DOM support only, independent
of `jsDependencies`.
…nker).

The previous test had basically been inhibited when we switched
the default environment from Rhino to Node.js. Indeed, this caused
`loadedJSEnv` not to use the linker itself, but rather depend on
the result of `fastOptJS`. The test was therefore not testing
anything anymore.

We restore this test in a more explicit and robust way, with a
custom task to concurrently use the linker of `fullOptJS`, and a
dedicated test task to directly depend on the former + `fullOptJS`.
We use `fullOptJS` instead of `fastOptJS` because it takes more
time, increasing the likelihood of concurrent execution.
Only trivial merge conflicts.

Additionally, the partest `run/t1430` and `run/t4729` are moved
to the blacklist in 2.12.2 and 2.13.0-M1. This brings those two
versions up to par with 2.12.0 and 2.12.1, for which they had been
blacklisted in 497e46351ae264e8b5ce8ee650515971733f9ec7.
The implementation of that feature was piggybacked on the
`JS_DEPENDENCIES` file maintained for the `jsDependencies`
mechanism. As the latter will be extracted in a separate sbt
plugin, the required semantics information will not be part of
all Scala.js artifacts, and will therefore be bogus. This means
that the `checkScalaJSSemantics` feature would not do its job
correctly anyway, and it is better to remove it than to give a
false sense of security.

An alternative would be to store the relevant information in a
separate file, but I do not believe it is worth it. Reasonable
Scala.js libraries should never require compliant semantics
anyway. Moreover, I have never had any feedback mentioning that
feature, which probably means no one ever saw that feature in
action, so it is useless.
This is part of scala-js/scala-js#2841.

* The contents of `org.scalajs.core.tools.jsdep._` are extracted in
  a separate project `jsdependencies-core`.
* All the settings related to `jsDependencies` are extracted in a
  separate sbt plugin `JSDependenciesPlugin` in
  `jsdependencies-plugin`.
This is the initial import of sbt plugin for `jsDependencies`
from the Scala.js core repository. The history of this commit
reflects the entire history of relevant files from the core repo,
filter-branch'ed to appear as if they had always been in this repo.
This commit adds the specific setup of the build and tests.
@sjrd sjrd requested a review from gzm0 June 1, 2017 12:15
@gzm0 gzm0 merged commit 4bbb100 into scala-js:master Jun 3, 2017
@sjrd sjrd deleted the import-from-core branch June 3, 2017 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants