-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ELDEpendenci/develop
- Loading branch information
Showing
11 changed files
with
119 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: build plugin | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build_plugin: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '16' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
run: mvn --batch-mode package | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: ELDependenci-SQL | ||
path: ./eldependenci-sql-plugin/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,37 +18,11 @@ jobs: | |
- name: Checkout Source Code | ||
id: checkout-source | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 16 | ||
id: setup-java | ||
uses: actions/setup-java@v1 | ||
- uses: eric2788/maven-jar-publish@v2 | ||
with: | ||
java-version: 16 | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
- name: Delete tag and release | ||
id: delete-tag-release | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
tag_name: ${{ env.version }} | ||
delete_release: true | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: ${{ env.version }} | ||
release_name: Release ${{ github.repository }}-${{ env.version }} | ||
body: | | ||
版本更新請到[這裏](https://eric2788.gitbook.io/eldependenci-sql/references/update/v0.0.5)查看。 | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release jar | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./${{ env.plugin_name }}/target/${{ env.plugin_name }}-${{env.version}}.jar # 請根據你插件名稱進行的修改 | ||
asset_name: ${{ env.plugin_name }}-${{ env.version }}.jar # 請根據你插件名稱進行的修改 | ||
asset_content_type: application/java-archive | ||
body: 版本更新請到[這裏](https://eric2788.gitbook.io/eldependenci-sql/references/update/v0.0.5)查看。 | ||
upload-module: './eldependenci-sql-plugin' | ||
- name: 'Update javadocs' | ||
id: update-javadoc | ||
uses: eric2788/push-javadoc-branch@main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...-sql-plugin/src/main/java/chu77/eldependenci/sql/manager/datasource/CustomDataSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package chu77.eldependenci.sql.manager.datasource; | ||
|
||
import chu77.eldependenci.sql.ELDSQLInstallation; | ||
import chu77.eldependenci.sql.config.Dbconfig; | ||
import org.hibernate.dialect.Dialect; | ||
|
||
import javax.inject.Inject; | ||
import javax.sql.DataSource; | ||
|
||
public final class CustomDataSource extends ELDSessionFactoryInterpreter{ | ||
|
||
private DataSource dataSource; | ||
|
||
@Inject | ||
private ELDSQLInstallation.CustomSource customSource; | ||
|
||
@Override | ||
public DataSource getDataSource() { | ||
if (dataSource == null){ | ||
throw new IllegalStateException("Custom DataSource is not set"); | ||
} | ||
return dataSource; | ||
} | ||
|
||
@Override | ||
public void initialize(Dbconfig dbconfig) { | ||
if (customSource.notInstalled()){ | ||
throw new IllegalStateException("using custom as data source but no custom data source was injected."); | ||
} | ||
this.dataSource = customSource.dataSource; | ||
this.loadEntityRegistration(this.dataSource, customSource.dialect); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters