Skip to content
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

ch.jodersky => com.github.sbt packages rename #55

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgrade gjavah [#43](https://github.com/sbt/sbt-jni/pull/43)
- Use cmake platform build tool [#40](https://github.com/sbt/sbt-jni/issues/40)
- Rename macro project to core and simplify Scala 3 support [#52](https://github.com/sbt/sbt-jni/pull/52)
- ch.jodersky => com.github.sbt packages rename [#55](https://github.com/sbt/sbt-jni/pull/55)

### Fixed
- javah failed with ClassCastException [#38](https://github.com/sbt/sbt-jni/issues/38)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Note that most plugins are enabled in projects by default. Disabling their funct

| Enabled | Source |
|--------------------------------|---------------|
| automatic, for all projects | [JniJavah.scala](plugin/src/main/scala/ch/jodersky/sbt/jni/plugins/JniJavah.scala)|
| automatic, for all projects | [JniJavah.scala](plugin/src/main/scala/com/github/sbt/jni/plugins/JniJavah.scala)|

This plugin wraps the JDK `javah` command [^1].

Expand Down Expand Up @@ -85,13 +85,13 @@ Note that native methods declared both in Scala and Java are supported. Whereas
### JniLoad
| Enabled | Source |
|--------------------------------|---------------|
| automatic, for all projects | [JniLoad.scala](plugin/src/main/scala/ch/jodersky/sbt/jni/plugins/JniLoad.scala) |
| automatic, for all projects | [JniLoad.scala](plugin/src/main/scala/com/github/sbt/jni/plugins/JniLoad.scala) |

This plugin enables loading native libraries in a safe and transparent manner to the developer (no more explicit, static `System.load("library")` calls required). It does so by providing a class annotation which injects native loading code to all its annottees. Furthermore, in case a native library is not available on the current `java.library.path`, the code injected by the annotation will fall back to loading native libraries packaged according to the rules of `JniPackage`.

#### Example use (Scala 2.x):
```scala
import ch.jodersky.jni.nativeLoader
import com.github.sbt.jni.nativeLoader

// By adding this annotation, there is no need to call
// System.load("adder0") before accessing native methods.
Expand All @@ -108,7 +108,7 @@ object Main extends App {

Note: this plugin is just a shorthand for adding `sbt-jni-core` (the project in `core/`) and the scala-macros-paradise (on Scala <= 2.13) projects as provided dependencies.

See the [annotation's implementation](core/src/main/scala/ch/jodersky/jni/annotations.scala) for details about the injected code.
See the [annotation's implementation](core/src/main/scala/com/github/sbt/jni/annotations.scala) for details about the injected code.

#### Example use (Scala 3.x / Scala 2.x):

Expand All @@ -124,7 +124,7 @@ sbtJniCoreScope := <Configuration>
```scala
// to make the code below work the core project should be included as a dependency via
// sbtJniCoreScope := Compile
import ch.jodersky.jni.syntax.NativeLoader
import com.github.sbt.jni.syntax.NativeLoader

// By adding this annotation, there is no need to call
// System.load("adder0") before accessing native methods.
Expand All @@ -138,7 +138,7 @@ class Adder(val base: Int) extends NativeLoader("adder0"):
### JniNative
| Enabled | Source |
|--------------------------------|---------------|
| manual | [JniNative.scala](plugin/src/main/scala/ch/jodersky/sbt/jni/plugins/JniNative.scala) |
| manual | [JniNative.scala](plugin/src/main/scala/com/github/sbt/jni/plugins/JniNative.scala) |

JniNative adds the capability of building native code (compiling and linking) to sbt, by interfacing with commonly used build tools.

Expand All @@ -158,7 +158,7 @@ nativeCompile / target := target.value / "native" / (nativePlatform).value,
### JniPackage
| Enabled | Source |
|--------------------------------|---------------|
| automatic, when JniNative enabled | [JniPackage.scala](plugin/src/main/scala/ch/jodersky/sbt/jni/plugins/JniPackage.scala) |
| automatic, when JniNative enabled | [JniPackage.scala](plugin/src/main/scala/com/github/sbt/jni/plugins/JniPackage.scala) |

This plugin packages native libraries produced by JniNative in a way that they can be transparently loaded with JniLoad. It uses the notion of a native "platform", defined as the architecture-kernel values returned by `uname -sm`. A native binary of a given platform is assumed to be executable on any machines of the same platform.

Expand Down Expand Up @@ -233,4 +233,4 @@ Run `sbt +publishLocal` to build and use this plugin locally.
## Copying
This project is released under the terms of the 3-clause BSD license. See [LICENSE](./LICENSE) for details.

`javah` is released under the terms of the MIT license since it uses Glavo's [gjavah](https://github.com/Glavo/gjavah). See [LICENSE](./plugin/src/main/java/ch/jodersky/sbt/jni/javah/LICENSE) for details.
`javah` is released under the terms of the MIT license since it uses Glavo's [gjavah](https://github.com/Glavo/gjavah). See [LICENSE](./plugin/src/main/java/com/github/sbt/jni/javah/LICENSE) for details.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ lazy val plugin = project
// make project settings available to source
Compile / sourceGenerators += Def.task {
val src = s"""|/* Generated by sbt */
|package ch.jodersky.sbt.jni
|package com.github.sbt.jni
|
|private[jni] object ProjectVersion {
| final val MacrosParadise = "${macrosParadiseVersion}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.jni
package com.github.sbt.jni

object Process {
def out(command: String): String =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.jni
package com.github.sbt.jni

import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.jni
package com.github.sbt.jni

object Process {
def out(command: String): String =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.jodersky.jni.syntax
package com.github.sbt.jni.syntax

import ch.jodersky.jni.Process
import com.github.sbt.jni.Process

import java.nio.file.{Files, Path}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ch.jodersky.sbt.jni.javah;
package com.github.sbt.jni.javah;

import java.util.Objects;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public final class ClassName {
private final String moduleName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ch.jodersky.sbt.jni.javah;
package com.github.sbt.jni.javah;

import ch.jodersky.sbt.jni.javah.search.ClassPath;
import ch.jodersky.sbt.jni.javah.search.ModulePath;
import ch.jodersky.sbt.jni.javah.search.RuntimeSearchPath;
import ch.jodersky.sbt.jni.javah.search.SearchPath;
import ch.jodersky.sbt.jni.javah.util.JNIGenerator;
import com.github.sbt.jni.javah.search.ClassPath;
import com.github.sbt.jni.javah.search.ModulePath;
import com.github.sbt.jni.javah.search.RuntimeSearchPath;
import com.github.sbt.jni.javah.search.SearchPath;
import com.github.sbt.jni.javah.util.JNIGenerator;

import java.io.PrintWriter;
import java.io.Writer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni.javah.resource;
package com.github.sbt.jni.javah.resource;

import java.util.Locale;
import java.util.ResourceBundle;
Expand All @@ -11,7 +11,7 @@ public final class Resource {
}

public static void reload(Locale locale) {
text = ResourceBundle.getBundle("ch.jodersky.sbt.jni.javah.resource.Text", locale);
text = ResourceBundle.getBundle("com.github.sbt.jni.javah.resource.Text", locale);
}

public static String getText(String key) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni.javah.resource;
package com.github.sbt.jni.javah.resource;

import java.util.ListResourceBundle;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni.javah.resource;
package com.github.sbt.jni.javah.resource;

import java.util.ListResourceBundle;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package ch.jodersky.sbt.jni.javah.search;
package com.github.sbt.jni.javah.search;

import ch.jodersky.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.ClassName;

import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public class ClassPath implements SearchPath {
private final Path path;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ch.jodersky.sbt.jni.javah.search;
package com.github.sbt.jni.javah.search;

import ch.jodersky.sbt.jni.javah.ClassName;
import ch.jodersky.sbt.jni.javah.util.Utils;
import com.github.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.util.Utils;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.jodersky.sbt.jni.javah.search;
package com.github.sbt.jni.javah.search;

import ch.jodersky.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.ClassName;

import java.io.IOException;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.jodersky.sbt.jni.javah.search;
package com.github.sbt.jni.javah.search;

import ch.jodersky.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.ClassName;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -10,7 +10,7 @@
import java.util.jar.Manifest;
import java.util.stream.Collectors;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public interface SearchPath {
Path search(ClassName name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.jodersky.sbt.jni.javah.util;
package com.github.sbt.jni.javah.util;

import ch.jodersky.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.ClassName;
import org.objectweb.asm.*;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ch.jodersky.sbt.jni.javah.util;
package com.github.sbt.jni.javah.util;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public final class Constant {
private static final List<Class<?>> TYPES = Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ch.jodersky.sbt.jni.javah.util;
package com.github.sbt.jni.javah.util;

import ch.jodersky.sbt.jni.javah.ClassName;
import ch.jodersky.sbt.jni.javah.search.RuntimeSearchPath;
import ch.jodersky.sbt.jni.javah.search.SearchPath;
import com.github.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.search.RuntimeSearchPath;
import com.github.sbt.jni.javah.search.SearchPath;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;

Expand All @@ -11,7 +11,7 @@
import java.nio.file.Path;
import java.util.*;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public class JNIGenerator {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package ch.jodersky.sbt.jni.javah.util;
package com.github.sbt.jni.javah.util;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

import java.util.Objects;
import java.util.regex.Matcher;

import static ch.jodersky.sbt.jni.javah.util.Utils.*;
import static com.github.sbt.jni.javah.util.Utils.*;

public final class NativeMethod {
private final int access;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.jodersky.sbt.jni.javah.util;
package com.github.sbt.jni.javah.util;

import ch.jodersky.sbt.jni.javah.ClassName;
import com.github.sbt.jni.javah.ClassName;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package build

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package build

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package build

import sbt._
Expand All @@ -11,7 +11,7 @@ object CMake extends BuildTool with ConfigureMakeInstall {
override def detect(baseDirectory: File) = baseDirectory.list().contains("CMakeLists.txt")

override protected def templateMappings = Seq(
"/ch/jodersky/sbt/jni/templates/CMakeLists.txt" -> "CMakeLists.txt"
"/com/github/sbt/jni/templates/CMakeLists.txt" -> "CMakeLists.txt"
)

override def getInstance(baseDir: File, buildDir: File, logger: Logger) = new Instance {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni.build
package com.github.sbt.jni.build

import sbt._

Expand All @@ -13,7 +13,7 @@ class Cargo(protected val release: Boolean = true) extends BuildTool {
baseDirectory.list().contains("Cargo.toml")

protected def templateMappings: List[(String, String)] = List(
"/ch/jodersky/sbt/jni/templates/Cargo.toml" -> "Cargo.toml"
"/com/github/sbt/jni/templates/Cargo.toml" -> "Cargo.toml"
)

def getInstance(baseDirectory: File, buildDirectory: File, logger: sbt.Logger): Instance =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package build

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package plugins

import java.net.URI
Expand Down Expand Up @@ -59,7 +59,7 @@ object JniJavah extends AutoPlugin {
javah := {
val out = (javah / target).value

val task = new ch.jodersky.sbt.jni.javah.JavahTask
val task = new com.github.sbt.jni.javah.JavahTask

val log = streams.value.log

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package plugins

import sbt._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package plugins

import build._
Expand Down Expand Up @@ -36,7 +36,7 @@ object JniNative extends AutoPlugin {
val nativeBuildToolInstance = taskKey[BuildTool#Instance]("Get an instance of the current native build tool.")

lazy val settings: Seq[Setting[_]] = Seq(
// the value retruned must match that of `ch.jodersky.jni.PlatformMacros#current()` of project `macros`
// the value retruned must match that of `com.github.sbt.jni.PlatformMacros#current()` of project `macros`
nativePlatform := {
try {
val lines = Process("uname -sm").lineStream
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package plugins

import sbt._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.jodersky.sbt.jni
package com.github.sbt.jni
package util

import java.io.{Closeable, File, FileInputStream}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package multiclasses

import ch.jodersky.jni.nativeLoader
import com.github.sbt.jni.nativeLoader

case class Value(x: Int)

Expand Down
Loading