|
5 | 5 | import act.app.ActionContext; |
6 | 6 | import act.app.App; |
7 | 7 | import act.app.AppHolder; |
| 8 | +import act.app.ProjectLayout; |
8 | 9 | import act.app.conf.AppConfigurator; |
9 | 10 | import act.app.event.AppEventId; |
10 | 11 | import act.app.util.NamedPort; |
|
30 | 31 |
|
31 | 32 | import javax.inject.Provider; |
32 | 33 | import javax.validation.MessageInterpolator; |
| 34 | +import java.io.File; |
33 | 35 | import java.text.DateFormat; |
34 | 36 | import java.text.SimpleDateFormat; |
35 | 37 | import java.util.*; |
@@ -704,6 +706,33 @@ private void _mergeUrlContext(AppConfig conf) { |
704 | 706 | } |
705 | 707 | } |
706 | 708 |
|
| 709 | + private String defViewName = null; |
| 710 | + private View defView = null; |
| 711 | + |
| 712 | + protected T defaultView(View view) { |
| 713 | + E.NPE(view); |
| 714 | + defView = view; |
| 715 | + return me(); |
| 716 | + } |
| 717 | + |
| 718 | + public View defaultView() { |
| 719 | + if (null == defViewName) { |
| 720 | + defViewName = get(AppConfigKey.VIEW_DEFAULT); |
| 721 | + if (null == defViewName) { |
| 722 | + defViewName = "rythm"; |
| 723 | + } |
| 724 | + defView = Act.viewManager().view(defViewName); |
| 725 | + } |
| 726 | + return defView; |
| 727 | + } |
| 728 | + |
| 729 | + private void _mergeDefaultView(AppConfig conf) { |
| 730 | + if (null == get(AppConfigKey.VIEW_DEFAULT)) { |
| 731 | + defViewName = conf.defViewName; |
| 732 | + defView = conf.defView; |
| 733 | + } |
| 734 | + } |
| 735 | + |
707 | 736 | private String xForwardedProtocol = null; |
708 | 737 |
|
709 | 738 | protected T forceHttps() { |
@@ -1673,33 +1702,6 @@ private void _mergeTemplateHome(AppConfig conf) { |
1673 | 1702 | } |
1674 | 1703 | } |
1675 | 1704 |
|
1676 | | - private String defViewName = null; |
1677 | | - private View defView = null; |
1678 | | - |
1679 | | - protected T defaultView(View view) { |
1680 | | - E.NPE(view); |
1681 | | - defView = view; |
1682 | | - return me(); |
1683 | | - } |
1684 | | - |
1685 | | - public View defaultView() { |
1686 | | - if (null == defViewName) { |
1687 | | - defViewName = get(AppConfigKey.VIEW_DEFAULT); |
1688 | | - if (null == defViewName) { |
1689 | | - defViewName = "rythm"; |
1690 | | - } |
1691 | | - defView = Act.viewManager().view(defViewName); |
1692 | | - } |
1693 | | - return defView; |
1694 | | - } |
1695 | | - |
1696 | | - private void _mergeDefaultView(AppConfig conf) { |
1697 | | - if (null == get(AppConfigKey.VIEW_DEFAULT)) { |
1698 | | - defViewName = conf.defViewName; |
1699 | | - defView = conf.defView; |
1700 | | - } |
1701 | | - } |
1702 | | - |
1703 | 1705 | private boolean pingPathResolved = false; |
1704 | 1706 | private String pingPath = null; |
1705 | 1707 |
|
@@ -1933,6 +1935,48 @@ private void _mergeSecret(AppConfig config) { |
1933 | 1935 | } |
1934 | 1936 | } |
1935 | 1937 |
|
| 1938 | + private List<File> extraSourceDirs; |
| 1939 | + public List<File> extraSourceDirs() { |
| 1940 | + if (null == extraSourceDirs) { |
| 1941 | + String v = get(AppConfigKey.SOURCE_DIR_EXTRA); |
| 1942 | + extraSourceDirs = processExtraSourceDirs(v); |
| 1943 | + } |
| 1944 | + return extraSourceDirs; |
| 1945 | + } |
| 1946 | + |
| 1947 | + private List<File> extraTestSourceDirs; |
| 1948 | + public List<File> extraTestSourceDirs() { |
| 1949 | + if (null == extraTestSourceDirs) { |
| 1950 | + String v = get(AppConfigKey.TEST_SOURCE_DIR_EXTRA); |
| 1951 | + extraTestSourceDirs = processExtraSourceDirs(v); |
| 1952 | + } |
| 1953 | + return extraTestSourceDirs; |
| 1954 | + } |
| 1955 | + |
| 1956 | + private List<File> processExtraSourceDirs(String v) { |
| 1957 | + if (S.blank(v)) { |
| 1958 | + return C.list(); |
| 1959 | + } else { |
| 1960 | + List<File> files = C.newList(); |
| 1961 | + File base = app.base(); |
| 1962 | + for (String s: v.trim().split("[;:]+")) { |
| 1963 | + s = s.trim(); |
| 1964 | + File file; |
| 1965 | + if (s.startsWith("/") || s.startsWith("\\")) { |
| 1966 | + file = new File(s); |
| 1967 | + } else { |
| 1968 | + file = ProjectLayout.Utils.file(base, s); |
| 1969 | + } |
| 1970 | + if (!file.isDirectory()) { |
| 1971 | + logger.warn("Cannot locate extra source dir: %s", s); |
| 1972 | + } else { |
| 1973 | + files.add(file); |
| 1974 | + } |
| 1975 | + } |
| 1976 | + return C.list(files); |
| 1977 | + } |
| 1978 | + } |
| 1979 | + |
1936 | 1980 | private MessageInterpolator _messageInterpolator = null; |
1937 | 1981 | protected T messageInterpolator(MessageInterpolator messageInterpolator) { |
1938 | 1982 | this._messageInterpolator = $.notNull(messageInterpolator); |
|
0 commit comments